Ship combat
The ship combat starts when the attacker ship tries to move into the space taken by the defender ship. The combat is played in turns. First the attacker ship shoots and deals damage to the defender, then the defender ship shoots and deals damage to the attacker. Below is my best understanding of how the combat is calculated, it has not been confirmed by StarDock yet. The attacker shoots each of its weapons in turn (laser, missile and mass driver weapons). Each weapon has a maximum attack value Amax (or simply attack value) associated with it, which can be checked in the ship info window. The shooting is performed by rolling a random number A between 0 and Amax. Then, for each weapon shot, a maximum defense value Dmax is calculated. For each weapon type there is optimum defense. For laser the optimum defense is shield, for missile it is point defense and for mass driver it is armor. All defense values are added together, but for non-optimal defense the square root is taken first and the value is rounded down (minimum of 1) before it is added to the other defenses. For example, if the attacker shoots with the laser and the defender has 1 in shields and 2 in armor then the maximum defense value is Dmax = 1 + RoundDown( \sqrt{2} ) = 1 + 1 = 2. (Note: the defense values can be modified by the presence of military starbases) After that the defense roll D is calculated by choosing a number between 0 and Dmax. The damage is calculated as the difference between the attack roll A and the defense roll D. If the damage value zero or negative, then the damage is deflected. The damage value is subtracted from the hit points of the defender ship. This procedure repeats until the attacker ship fires all its weapons. After that the attacker and defender change roles, and the defender ship starts firing its weapons. The process stops when hit points of one of the ships become equal or less than zero. Darth Kryo's Fleet Combat Simulator can be used to simulate fleet combats outside the game using ships with attack, defense, and hit point values you supply. See also fleet combat. ; Note: : It appears that the manual's description placing the minimum attack and defense rolls as 1 is incorrect. According to Lead Developer Cari Begle, all rolls have a minimum of 0, and deflections (0-damage hits) are possible, but apparently not shown in the battle viewer. ; The Math: Based on the assumptions that attack follows from a uniform discrete distribution from 0 to attack value and defense follows from a uniform discrete distribution from 0 to defense value, the following can be ascertained: For the function f'' mapping attack ''a and defense d to mean damage per round, there are 2 distinct cases, mainly arising from the fact that attack and defense are not symmetric with one another: : f(a,d) = \begin{cases} \frac{a(a+2)}{6(d+1)} & \text{if } a \leq d \\ \frac{a-d}{2} + \frac{d(d+2)}{6(a+1)} & \text{if } a > d \end{cases} : f(a+1,d) - f(a,d) = \begin{cases} \frac{2a+3}{6(d+1)} & \text{if } a < d \\ \frac{1}{2} - \frac{d(d+2)}{6(a+1)(a+2)} & \text{if } a \geq d \end{cases} Interpreted, this means that if attack and defense both increases lockstep on a 1 to 1 basis, mean damage per round still increases by about \frac{1}{6} per point. 59 attack versus 59 defense will cause about 1 more mean damage per round than 53 attack versus 53 defense. When defense is greater than attack, defense in the denominator is a linear function running against a quadratic attack function on the numerator. When attack grows larger in comparison to defense the formula slowly morphs from \frac{2y-x}{6} to \frac{y-x}{2} . Early defense looks good because of the huge constant (6, compared to 2 with no defense) attached to it, but the effect diminishes once your defense reaches parity with the enemy offense. (To understand defense in more detail, you should look at the reciprocal or logarithm of expected damage dealt.) If you want an even more watered down interpretation, here it goes: The first few points of attack are very weak against high defenses, but subsequent points provide increasing returns, reaching roughly \frac{1}{3} point of damage per round with attack equal to defense, and converging to \frac{1}{2} point of damage per round when attack vastly exceeds defense. Each point of defense takes away roughly \frac{1}{3} point of damage per round until defense matches attack, then it tapers off. Category: Space combat Category:Data and formulas